Make Result class containt Java's BufferedImage field#30
Make Result class containt Java's BufferedImage field#30IceMajor2 wants to merge 5 commits intoimagekit-developer:masterfrom
Conversation
|
Thank you for the contribution! However, we've decided not to merge this PR for the following reasons:
val response = client.files().upload(params)
val bufferedImage = ImageIO.read(URL(response.url()))The SDK intentionally stays lean and focused. Users needing additional image processing can easily implement it on their side. |
Hi. I've been recently using ImageKit library for Java, mainly for uploading images programmatically. Throughout my not-so-long experimenting with it, I've found that it may perhaps be helpful to have a ready-to-use Java AWT's image object after having sent an image to external hosting (ImageKit :) ).
I've taken a stab at trying to accomplish so.
GOAL: Result class contains BufferedImage field
Problem: Not every file needs to be an image and not every image will neccessarily be read by
ImageIO.read.In
FileCreateRequestclass, I've addedisReadableImagefield, which is set whenever any of the 3 constructors is called.In
Utils, I've writtenisReadableImagemethods. They take a reference to image source in forms of base64-encoded string, simple String path or instance ofURLclass. I've also written tests for them which pass (they test for both files that are images, and for simple .txt file). Note: theisReadableImagemethod will not returntruefor every image asImageIO.readdoes not support every format. For example, in order to read.webpimages this way, we would additionally need plugins, which I've not included.I've also thought of creating another Result class, especially for images, but I realised it may be too much at once ;)
This is my first contribution to open source project, I'd love some feedback. I'm open to work on this as well as on other issues.